import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.vod.model.v20170321.GetPlayInfoRequest;
import com.aliyuncs.vod.model.v20170321.GetPlayInfoResponse;
import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthRequest;
import com.aliyuncs.vod.model.v20170321.GetVideoPlayAuthResponse;

import java.util.List;

/**
 * @description:
 * @author: Administrator
 * @date: 2021-04-02 20:57
 */
public class main {
    public static void main(String[] args) throws ClientException {
        //初始化
        DefaultAcsClient client = init.initVodClient("LTAI4GCW5EJqes1uQuuBPmX3",
                "MYxIFbStcZ1Vzgg9IeCMiYcRLwQJM8");
        //请求信息
        GetPlayInfoRequest request = new GetPlayInfoRequest();
        request.setVideoId("23c0816d094248f28f48a29325388515");
        GetVideoPlayAuthRequest requestVideo = new GetVideoPlayAuthRequest();
        requestVideo.setVideoId("23c0816d094248f28f48a29325388515");
        //响应接受请求的内容
        GetPlayInfoResponse response = new GetPlayInfoResponse();
        response = client.getAcsResponse(request);

        GetVideoPlayAuthResponse responseVideo = new GetVideoPlayAuthResponse();
        responseVideo = client.getAcsResponse(requestVideo);
        //获取相应信息
        List<GetPlayInfoResponse.PlayInfo> playInfoList = response.getPlayInfoList();
        //播放地址
        for (GetPlayInfoResponse.PlayInfo playInfo : playInfoList) {
            System.out.print("播放地址 = " + playInfo.getPlayURL() + "\n");
            //标题信息
            System.out.print("标题信息 = " + response.getVideoBase().getTitle() + "\n");
            //凭证
            System.out.print("凭证 = " + responseVideo.getPlayAuth() + "\n");

        }
    }
}
